<?php
$link = mysqli_connect("localhost","root","root","2113");
// 总的数据条数；
$sql="SELECT COUNT(*) AS c FROM message";
$res=mysqli_query($link,$sql);
$one=mysqli_fetch_assoc($res);
$total=$one['c']; // 数据的总条数；
// 每页显示多少条 
$perPage=5;
// 页码的总数；
$totalPage=ceil($total/$perPage);
// echo $totalPage;
$arr['totalPage']=$totalPage;
echo json_encode($arr);

?>